home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / bash / bash-108 / 108src~1.zoo / bash-d2.zoo / readline / read.diff < prev   
Encoding:
Text File  |  1991-09-03  |  8.0 KB  |  331 lines

  1. diff -c ./readline.c /home/scott/work/bash-1.08/readline/readline.c
  2. *** ./readline.c    Mon May 20 05:19:43 1991
  3. --- /home/scott/work/bash-1.08/readline/readline.c    Fri Aug 23 02:13:53 1991
  4. ***************
  5. *** 30,35 ****
  6. --- 30,44 ----
  7.   static char *xmalloc (), *xrealloc ();
  8.   #endif
  9.   
  10. + /**
  11. +  ** (sjk)++ On an Atari we need these for the xconsole routines and the 
  12. +  ** definitions of the scan codes for the extended keyboard.
  13. +  **/
  14. + #if defined(atarist)
  15. + #include <osbind.h>
  16. + #include <keycodes.h>
  17. + #endif
  18.   #include <stdio.h>
  19.   #include <sys/types.h>
  20.   #include <fcntl.h>
  21. ***************
  22. *** 48,55 ****
  23.   #include <unistd.h>
  24.   #endif
  25.   
  26. ! #define NEW_TTY_DRIVER
  27. ! #define HAVE_BSD_SIGNALS
  28.   /* #define USE_XON_XOFF */
  29.   
  30.   /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
  31. --- 57,64 ----
  32.   #include <unistd.h>
  33.   #endif
  34.   
  35. ! #define NEW_TTY_DRIVER 
  36. ! /* #define HAVE_BSD_SIGNALS */
  37.   /* #define USE_XON_XOFF */
  38.   
  39.   /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
  40. ***************
  41. *** 84,89 ****
  42. --- 93,106 ----
  43.   #include <sgtty.h>
  44.   #endif
  45.   
  46. + /** 
  47. +  ** (sjk)++ sgtty.h defines META on the Atari ST, so we must undefine it so we 
  48. +  **         get the proper definition of the META macro from readline.h
  49. +  **/
  50. + #if defined(atarist)
  51. + #undef META
  52. + #endif
  53.   #include <errno.h>
  54.   extern int errno;
  55.   
  56. ***************
  57. *** 170,175 ****
  58. --- 187,193 ----
  59.   #define HANDLE_SIGNALS
  60.   
  61.   
  62.   /* **************************************************************** */
  63.   /*                                    */
  64.   /*            Line editing input utility            */
  65. ***************
  66. *** 289,294 ****
  67. --- 307,332 ----
  68.   /*                                    */
  69.   /* **************************************************************** */
  70.   
  71. + /**
  72. +  ** (sjk)++ To get the keyboard mapping right we use the I/O routines 
  73. +  **         from xconsole.c in the termcap library. Here we initialize 
  74. +  **         a few of the more common keys.
  75. +  **/
  76. + #if defined(atarist)
  77. + void initialize_st_bindings()
  78. + {   
  79. +   console_set_key(CURS_UP,"\020"   , (char *)0, (char *)0);
  80. +   console_set_key(CURS_DN,"\016"   , (char *)0, (char *)0);
  81. +   console_set_key(CURS_LF,"\002"   , (char *)0, (char *)0);
  82. +   console_set_key(CURS_RT,"\006"   , (char *)0, (char *)0);
  83. +   console_set_key(K_UNDO, "logout ", "logout
  84. ", (char *)0);
  85. +   console_set_key(K_HELP, "help "  , "help
  86. ", (char *)0);
  87. +   console_set_key(K_INS,  "\t", "echo -en \"\\033E\\\033e
  88. \" ", (char *)0);
  89. +   console_set_key(0x2d,"x","X","\033x");
  90. + }
  91. + #endif
  92.   /* Read a line of input.  Prompt with PROMPT.  A NULL PROMPT means
  93.      none.  A return value of NULL means that EOF was encountered. */
  94.   char *
  95. ***************
  96. *** 529,535 ****
  97. --- 567,580 ----
  98.         }
  99.   #else
  100.   #if defined (HAVE_BSD_SIGNALS)
  101. + /**
  102. +  ** (sjk)++ Quitely Ignored on the Atari ST (for now!)
  103. +  **/
  104. + #if !defined(atarist)
  105.         sigsetmask (0);
  106. + #endif
  107.   #endif /* HAVE_BSD_SIGNALS */
  108.   #endif /* _POSIX_VERSION */
  109.   
  110. ***************
  111. *** 678,687 ****
  112.     long chars_avail;
  113.     char input;
  114.   
  115.   #ifdef FIONREAD
  116.     result = ioctl (tty, FIONREAD, &chars_avail);
  117.   #endif
  118.     if (result == -1)
  119.       {
  120.         int flags;
  121. --- 723,736 ----
  122.     long chars_avail;
  123.     char input;
  124.   
  125. + /**
  126. +  ** (sjk)++ For the Atari ST, we use the xconsole routines from termcap 
  127. +  **         to do all the console I/O.                  (thanx Jwahar!)
  128. +  **/
  129. + #if !defined(atarist)
  130.   #ifdef FIONREAD
  131.     result = ioctl (tty, FIONREAD, &chars_avail);
  132.   #endif
  133.     if (result == -1)
  134.       {
  135.         int flags;
  136. ***************
  137. *** 695,704 ****
  138.         if (chars_avail == -1 && errno == EAGAIN)
  139.       return;
  140.       }
  141.   
  142.     /* If there's nothing available, don't waste time trying to read
  143.        something. */
  144. !   if (chars_avail == 0)
  145.       return;
  146.   
  147.     tem = ibuffer_space ();
  148. --- 744,764 ----
  149.         if (chars_avail == -1 && errno == EAGAIN)
  150.       return;
  151.       }
  152. + #endif 
  153. + #if defined(atarist)
  154. +     if (console_input_status(tty) == 0)          /* tty = fileno(input) */
  155. +       { chars_avail = -1; 
  156. +         return;
  157. +       }
  158. +     else 
  159. +       { chars_avail = 1;
  160. +         input = (char)console_read_byte(tty);     /* tty = fileno(input) */
  161. +       }
  162. + #endif
  163.   
  164.     /* If there's nothing available, don't waste time trying to read
  165.        something. */
  166. !   if (chars_avail < 1)
  167.       return;
  168.   
  169.     tem = ibuffer_space ();
  170. ***************
  171. *** 1038,1043 ****
  172. --- 1098,1110 ----
  173.   {
  174.     extern char *rl_display_prompt;
  175.   
  176. + /** 
  177. +  ** (sjk)++ This is where the Atari ST key bindings are really initialized.
  178. +  **/
  179. + #if defined(atarist)
  180. +    initialize_st_bindings();
  181. + #endif
  182.     /* If we have never been called before, initialize the
  183.        terminal and data structures. */
  184.     if (!rl_initialized)
  185. ***************
  186. *** 1758,1764 ****
  187.         putc (data[i], out_stream);
  188.   #else
  189.         for (i = last_c_pos; i < new; i++)
  190. !     putc (data[i], out_stream);
  191.   #endif                /* HACK_TERMCAP_MOTION */
  192.       }
  193.     else
  194. --- 1825,1831 ----
  195.         putc (data[i], out_stream);
  196.   #else
  197.         for (i = last_c_pos; i < new; i++)
  198. !       putc (data[i], out_stream);
  199.   #endif                /* HACK_TERMCAP_MOTION */
  200.       }
  201.     else
  202. ***************
  203. *** 2128,2134 ****
  204.   
  205.         for (i = 0; i < count; i++)
  206.       putc (' ', out_stream);
  207.         backspace (count);
  208.       }
  209.   }
  210. --- 2195,2200 ----
  211. ***************
  212. *** 2186,2191 ****
  213. --- 2252,2267 ----
  214.   #if !defined (ANYP)
  215.   #define ANYP (EVENP | ODDP)
  216.   #endif
  217. + /**
  218. +  ** (sjk)++ On the Atari ST we set the terminal to (RAW || PASS8) mode 
  219. +  **         to give 8bit Meta Key support.
  220. +  **/
  221. + #if defined(atarist)
  222. +        the_ttybuff.sg_flags |= (RAW || PASS8);
  223. + #define LPASS8 PASS8
  224. + #endif 
  225.         /* If this terminal doesn't care how the 8th bit is used,
  226.        then we can use it for the meta-key.
  227.        We check by seeing if BOTH odd and even parity are allowed. */
  228. ***************
  229. *** 2254,2260 ****
  230. --- 2330,2343 ----
  231.   #endif /* TIOCGLTC */
  232.   
  233.         the_ttybuff.sg_flags &= (~ECHO|CRMOD);
  234. + /** 
  235. +  ** (sjk)++ Atari ST always should be in RAW mode
  236. +  **/
  237. + #if !defined(atarist)
  238.         the_ttybuff.sg_flags |= CBREAK;
  239. + #else
  240. +       the_ttybuff.sg_flags |= RAW;
  241. + #endif
  242.         ioctl (tty, TIOCSETN, &the_ttybuff);
  243.   
  244.         terminal_prepped = 1;
  245. ***************
  246. *** 3790,3796 ****
  247.                 temp = matches[l];
  248.               else
  249.                 temp++;
  250.               fprintf (out_stream, "%s", temp);
  251.               for (k = 0; k < max - strlen (temp); k++)
  252.                 putc (' ', out_stream);
  253. --- 3873,3878 ----
  254. ***************
  255. *** 5040,5045 ****
  256. --- 5122,5135 ----
  257.       {
  258.         char *rindex (), *temp;
  259.   
  260. + /**
  261. +  ** (sjk)++ We need to alway close, then reopen the directory just
  262. +  **         incase some external command wrote a Auto Symbolic link
  263. +  **         that invalidates the symdir cache.
  264. +  **/
  265. + #if defined(atarist)
  266. +       _del_symdir_cache();
  267. + #endif
  268.         if (dirname) free (dirname);
  269.         if (filename) free (filename);
  270.         if (users_dirname) free (users_dirname);
  271. ***************
  272. *** 5075,5081 ****
  273.   
  274.         rl_filename_completion_desired = 1;
  275.       }
  276.     /* At this point we should entertain the possibility of hacking wildcarded
  277.        filenames, like /usr/man*\/te<TAB>.  If the directory name contains
  278.        globbing characters, then build an array of directories to glob on, and
  279. --- 5165,5171 ----
  280.   
  281.         rl_filename_completion_desired = 1;
  282.       }
  283. !  
  284.     /* At this point we should entertain the possibility of hacking wildcarded
  285.        filenames, like /usr/man*\/te<TAB>.  If the directory name contains
  286.        globbing characters, then build an array of directories to glob on, and
  287. ***************
  288. *** 5930,5936 ****
  289.   {
  290.     int result;
  291.     unsigned char c;
  292.     while (1)
  293.       {
  294.         result = read (fileno (stream), &c, sizeof (char));
  295. --- 6020,6030 ----
  296.   {
  297.     int result;
  298.     unsigned char c;
  299. ! /**
  300. !  ** (sjk)++ We again use the termcap xconsole routines to do input 
  301. !  **         from the console.
  302. !  **/
  303. ! #if !defined(atarist)
  304.     while (1)
  305.       {
  306.         result = read (fileno (stream), &c, sizeof (char));
  307. ***************
  308. *** 5941,5946 ****
  309. --- 6035,6043 ----
  310.         if (errno != EINTR)
  311.       return (EOF);
  312.       }
  313. + #else 
  314. +    result = console_read_byte(fileno(stream));
  315. + #endif 
  316.   }
  317.   
  318.   #ifdef STATIC_MALLOC
  319.